package com.example.easydownloadback.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.easydownloadback.domin.File;
import com.example.easydownloadback.domin.ResponseResult;
import com.example.easydownloadback.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/u")
public class UFileController {
    @Autowired
    private FileService fileService;
    @GetMapping("/pageByType")
    public ResponseResult<IPage<File>> listFileByFileType (
            @RequestParam("pageNum") Integer pageNum,
            @RequestParam("pageSize") Integer pageSize,
            @RequestParam("fileType") String fileType) {
        return fileService.listFileByFileType(pageNum, pageSize, fileType);
    }
    @GetMapping("/pageBySelectData")
    public ResponseResult<IPage<File>> listFileBySelectData (
            @RequestParam("pageNum") Integer pageNum,
            @RequestParam("pageSize") Integer pageSize,
            @RequestParam(value = "selectData", required = false) String selectData) {
        return fileService.listFileBySelectData(pageNum, pageSize, selectData);
    }
}
